
#import "PUFoodDetailsCell.h"

@implementation PUFoodDetailsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupViews];
    }
    return self;
}

- (void)setupViews {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.textLab = [[UILabel alloc]init];
    self.textLab.text = @"发布人";
    self.textLab.font = [UIFont boldSystemFontOfSize:13];
    self.textLab.numberOfLines = 0;
    [self.contentView addSubview:self.textLab];
    [self.textLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset = 15;
        make.top.offset = 15;
        make.right.offset = -15;
    }];
    
    self.pictureView = [[UIImageView alloc]init];
    self.pictureView.contentMode = UIViewContentModeScaleAspectFill;
    self.pictureView.clipsToBounds = true;
    self.pictureView.layer.cornerRadius = 32/2;
    [self.contentView addSubview:self.pictureView];
    [self.pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset = 15;
        make.top.equalTo(self.textLab.mas_bottom).offset = 10;
        make.right.offset = -15;
        make.height.offset = 250;
        make.bottom.offset = -15;
    }];
}

- (void)setModel:(CPStepModel *)model {
    self.textLab.text = model.text;
    [self.pictureView sd_setImageWithURL:[NSURL URLWithString:model.image]];
}

@end
